﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace NeurOthello.Logic
{
    
    public class Heuristic
    {
        private double weight1;
        private double weight2;
        private double weight3;

        public Heuristic(double wDivider, double wValue, double wCountMove) { 
            this.weight1 = wDivider;
            this.weight2 = wValue;
            this.weight3 = wCountMove;
        }


        public Heuristic() { }

        public virtual double Weights(Othello o, int playerID) {
            int cm, black = 0, white = 0, unMarked = 0, safeScore;
            double value = 0;

            cm = o.CountMoves(playerID) - o.CountMoves(3 -playerID);
            o.boardCount(ref black, ref white, ref unMarked);
            if (unMarked < 17)
            {
                if (playerID == 1)
                    value = (black - white);// * (1 / Math.Pow((unMarked + 1), weight1));
                else
                    value = (white - black);// *(1 / Math.Pow((unMarked + 1), weight1));
            }
            else value = o.SafeScore(playerID) - o.SafeScore(3-playerID);
            safeScore = 0;// o.SafeScore(playerID) - o.SafeScore(Othello.Opponent(playerID));
            return ((value * (weight2)) + (cm * weight3));
            //return white - black;
        }




    }
}
